home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-08-22 | 4.7 KB | 121 lines | [TEXT/Pico] |
- #
- # Welcome to Pico. Pico ("Picture Composition") is described in
- # Gerard Holzmann's book, "Beyond Photography - the Digital Darkroom"
- # (published by Prentice Hall). Pico takes an expression, similar to
- # assignment statements in the C language, and applies that expression
- # to every pixel in the image. This file contains some demonstration
- # expressions.
- #
- # (Note: Before proceeding ahead, use the “Monitors” icon in the
- # control panel to set your screen to the maximum number of grays or colors.)
- #
- # The destination of Pico expressions is always an image variable
- # called "new". For example, consider the expression:
-
- new[x,y] = x
- # If you click the cursor on the line above and hit the “Enter” key, you
- # should see a nice ramp of gray (dark on the left, light on the right) in
- # the “Image” window. What the expression means is “assign each pixel the
- # value of its x coordinate” (x increases from left to right, y increases from
- # bottom to top)
- #
- # Since the destination image must be "new", the left side of the equation
- # can be omitted if's the default, new[x,y]. E.g, the following line:
- y
- #
- # produces a ramp from top to bottom if you move the cursor on it and
- # hit Enter. The results of a computation are saved in a special image
- # called "old". So if you evaluate:
-
- old[y,x]
-
- # you see the previous image (the ramp) with its coordinates swapped, which
- # rotates it 90 degrees.
- #
- # If the value of a pixel exceeds the maximum (255), the value mod 255 is
- # displayed (i.e., the value “wraps around”).
- #
- # The program defines a few useful constants, X and Y are the maximum
- # x and y coordinates, and Z is the maximum brightness of a pixel.
- #
- # Now try some expressions from Holzmann's book:
-
- x + y
- (Z*x*y)/((X-1)*(Y-1))
- x%(y+1)
- x | y
-
- #
- # You can also work in polar coordinates. The variable "a" is set to the
- # angle of a pixel's position from the x axis. The variable "r" (radius) is
- # the distance a particular pixel is from the center of the screen. The
- # constant "A" is the maximum angle (360) and "R" is the maximum radius (181).
- # Here's a couple expressions to help visualize this:
- #
- (Z * a) / A # Brightness increases with angle
- (Z * r) / R # Brightness increases with radius
-
- # Some fun things to do with polar coordinates:
-
- (((a+r)%16)-8)*Z / 16+Z/2
- (r > 100 ) ? X-x : (r < 50) ? X-x : x
- (((a+1) / 30) % 2 == 0) ? r : Z-r
- (r>80) ? ((((a+1)/30)%2 == 0) ? r:Z-r) : Z - ((((a+1)/30)%2 == 0) ? r : Z-r)
- (a + 1) % 2 ? 0 : Z
- ((Z * a) / A) | ((Z * r) / R)
-
- #
- # Of course, it's much more interesting to use Pico to process digital images.
- # Use “Load Image” from the “Image” menu to load the image “lenna” into Pico.
- #
- # Now you can use Pico expressions to process the image:
-
- lenna[x+(x%32)-16,y]
- new = (lenna[x+1,y] + lenna[x-1,y] + lenna[x,y+1] + lenna[x,y-1])/4
- (x < 128) ? lenna : lenna[X-x,y]
- lenna[(a * X) / A, (r * Y) / R]
- lenna + (Z/2-lenna[x+2,y+2])
- lenna[(x/8) * 8, (y/8) * 8]
- lenna[x+((a+r/10)%32)-16,y]
- lenna;(old >= 64 && old < 192) ? old * 2 - 128 : (old < 64 ? 0 : Z)
-
-
- # Also, you can use Pico to combine multiple images. For example,
- # load the image "clouds" and try the following:
-
- clouds
- (lenna * clouds) / Z
- (clouds > Z/5) ? lenna : lenna / 3
- (lenna * clouds) / Z + (Z-clouds)
- (x<X/3) ? clouds : ((x>2 * X/3) ? lenna : ((x-X/3)*lenna+(2*X/3-x)*clouds)/(X/3))
- lenna[x,y+clouds/12]
-
- # If you find the above a bit confusing, the best thing to do is obtain
- # a copy of Holzmann's book - it goes into much more detail, and has
- # a large collection of interesting expressions. Also, if you need help
- # with the menus, try turning on "Show Balloons" and pointing at the menus
- # (if you're running System 7)
- #
- # In addition to processing images with expressions, several custom effects
- # are available in the “Effects” menu. These operate on the currently
- # displayed image. If an Effect has "(Slow)" in its name, take this as a
- # warning that it may take a minute or two to run, depending on what
- # kind of Mac you have. Think C programmers can add their own effects,
- # see the file “Adding effects” for instructions on how to do this.
- #
- ##################### Some notes about the Mac version #####################
- #
- # You can play with the subscripts on the left hand side. E.g.:
-
- 0;0;new[x,(y+lenna/8) % Y] = lenna[x,y]
-
- # The "0"s are to clear out the image first, since every pixel isn't written.
- #
- # The "r" and "a" variables simply look up the radius and angle of the current
- # pixel. They don't work on the left side as subscripts like Holzmann's do.
- #
- # Mac Pico reads standard PICT files, so you can use picture files generated
- # from other sources. They will be scaled to fit the standard 256x256 gray
- # scale window when they are read in. If the image window is selected, you
- # can copy an image from Pico for pasting into other applications.
-